var rpio = require('rpio');

function blink() {
   rpio.i2cBegin();
   rpio.i2cSetSlaveAddress(0x50);
   rpio.i2cSetBaudRate(10000); // 100kHz
   rpio.i2cSetClockDivider(2500);
   var txbuf = Buffer.from([0x01, 0x02, 0x03, 0x04]);
   var rxbuf = Buffer.alloc(32)
   rpio.i2cWrite(txbuf);           /* Sends 4 bytes */
   rpio.msleep(1000);
   rpio.i2cRead(rxbuf, 16);
   rpio.i2cEnd();
   console.log('rxbuf = ' + JSON.stringify(rxbuf));
}
blink();
